package genosAgape.ui.menuPrincipal;

import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.TexturePaint;
import java.awt.geom.Rectangle2D;
import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JPanel;
import java.awt.BorderLayout;



public class Background extends  JPanel{

	private static final long serialVersionUID = 3327056960046199703L;
	private BufferedImage b;
	private Rectangle2D rect;

	public Background() throws IOException {
		setLayout(new BorderLayout(0, 0));
		b = ImageIO.read(getClass().getResourceAsStream("/genosAgape/ui/img/background.png"));
		rect = new Rectangle(0, 0, 429, 317);
	}
	
	@Override
	public void paintComponent(Graphics g) {
		TexturePaint p = new TexturePaint(b, rect);
		Graphics2D g2 = (Graphics2D) g;
		g2.setPaint(p);
		g2.fillRect(0, 0, this.getWidth(), this.getHeight());
	}
}
